﻿@model List<NavItemVM>
<div class="section-header">
    <div class="wrapper clearfix">
        <h1 class="js-hidden">Lydia</h1>
        <div class="logo-wrapper fl">
            <a href="" class="logo-title">
              <img class="logo-header" src="/images/logo.png" alt="">
                土豆AI发展有限责任公司
            </a>
        </div>
        <div class="fr">
            <a href="javascript: void(0)" class="wap-search-trigger"></a>
            <a href="javascript: void(0)" class="wap-nav-trigger"></a>
            <div class="body-mask"></div>
            <div class="search-container clearfix fr">
                <form action="#">
                    <div class="form-inner">
                        <div class="search-text fl">
                            <input type="text" name="word" class="search-keyword" placeholder="请输入搜索内容">
                        </div>
                        <button type="submit" class="search-button"></button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<div class="section-nav">
    <div class="wrapper">
        <ul class="nav">
            <li class="nav-item first-item cur" data-navindex="home">
                <a href="/" title="">首页</a>
            </li>
            @if (Model.Any())
            {
                foreach (var item in Model)
                {
                    <li class="nav-item" data-navindex="@item.NavIndex">
                        @switch (item.LinkTypeEnum)
                        {
                            case LinkType.None:
                                if (!string.IsNullOrEmpty(item.LinkUrl) && item.LinkUrl.ToLower().LastIndexOf("http") > -1)
                                {
                                    <a href="@item.LinkUrl">@item.NavName</a>
                                }
                                else
                                {
                                    <a href="@item.LinkUrl?id=@item.Id">@item.NavName</a>
                                }
                                break;
                            case LinkType.LinkToFirstChannel:
                                <a href="/ChanUI?id=@item.Id">@item.NavName</a>
                                break;
                            case LinkType.LinkToChannel:
                                <a href="/ChanUI?id=@item.LinkUrl">@item.NavName</a>
                                break;
                            case LinkType.LinkToFirstContent:
                                <a href="/ContentUI?id=@item.LinkUrl">@item.NavName</a>
                                break;
                            case LinkType.LinkToOnlyOneContent:
                                if (item.FirstContentId.HasValue)
                                {
                                    <a href="/ContentUI?id=@item.FirstContentId">@item.NavName</a>
                                }
                                else
                                {
                                    <a href="javascript:void(0)">@item.NavName</a>
                                }
                                break;
                            case LinkType.NoLink:
                                <a href="javascript:void(0)">@item.NavName</a>
                                break;
                        }
                        

                        @if (item.Children != null && item.Children.Count() > 0)
                        {
                            <ul class="nav-sub">
                                @foreach (var sub in item.Children)
                                {
                                    <li class="nav-sub-item">
                                        @switch (sub.LinkTypeEnum)
                                        {
                                            case LinkType.None:
                                                if (!string.IsNullOrEmpty(sub.LinkUrl) && sub.LinkUrl.ToLower().LastIndexOf("http")>-1)
                                                {
                                                    <a href="@sub.LinkUrl">@sub.NavName</a>
                                                }
                                                else
                                                {
                                                    <a href="@sub.LinkUrl?id=@sub.Id">@sub.NavName</a>
                                                }
                                                break;
                                            case LinkType.LinkToFirstChannel:
                                                <a href="/ChanUI?id=@sub.Id">@sub.NavName</a>
                                            break;
                                            case LinkType.LinkToChannel:
                                                <a href="/ChanUI?id=@sub.LinkUrl">@sub.NavName</a>
                                            break;
                                            case LinkType.LinkToFirstContent:
                                                <a href="/ContentUI?id=@sub.LinkUrl">@sub.NavName</a>
                                                break;
                                            case LinkType.LinkToOnlyOneContent:
                                                if (sub.FirstContentId.HasValue)
                                                {
                                                    <a href="/ContentUI?id=@sub.FirstContentId">@sub.NavName</a>
                                                }
                                                else
                                                {
                                                    <a href="javascript:void(0)">@sub.NavName</a>
                                                }
                                                break;
                                            case LinkType.NoLink:
                                                <a href="javascript:void(0)">@sub.NavName</a>
                                            break;
                                       }
                                    </li>
                                }
                           </ul>
                        }
                    </li>
                }
            }
        </ul>
    </div>
</div>